package com.leicx.guli.auth;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;

/**
 * spring session 核心原理：
 * EnableRedisHttpSession导入了RedisHttpSessionConfiguration配置
 *  1、给容器中放入了RedisOperationsSessionRepository用来操作redis
 *  2、SessionRepositoryFilter：session存储过滤器
 *      2.1 SessionRepositoryFilter<S> sessionRepositoryFilter = new SessionRepositoryFilter<>(
 * 				sessionRepository);
 * 		构造方法中传入了一个SessionRepository，就是第一步中的RedisOperationsSessionRepository，
 * 		然后每次都执行SessionRepositoryFilter的doFilterInternal方法
 * 	    2.2 原生的request，response都被包装SessionRepositoryRequestWrapper、SessionRepositoryResponseWrapper，
 * 	    以后request.getSession()就是调用SessionRepositoryRequestWrapper.getSession()
 * @author daxiong
 * @date 2022/7/26 上午10:00
 */
@EnableRedisHttpSession
@EnableFeignClients
@EnableDiscoveryClient
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
public class AuthMain {
    public static void main(String[] args) {
        SpringApplication.run(AuthMain.class, args);
    }
}
